package pure.engine.entity 
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.display.TriangleCulling;
	import pure.engine.system.ns_despair;
	
	use namespace ns_despair
	
	/**
	 * @internal
	 * 
	 * 残像
	 * 
	 * @author Pure
	 */
public class Mirror extends Bitmap 
{
	public function Mirror()
	{
		super();
	}

	
	
	ns_despair var entity:Entity;
	
	
	public function get layer():int { return entity.m_layer; }
	public function get id():int { return entity.m_id; }
	
	
	// 滑鼠检测用
	override public function get name():String { return entity.m_name; }
	override public function get x():Number { return super.x + entity.m_range; }
	override public function get y():Number { return super.y + entity.m_range; }
	
	
	
	override public function toString():String
	{
		return entity.m_name + ':' + entity.m_layer;
	}
	
	
	ns_despair function binding(E:Entity):void
	{
		entity = E;
		this.bitmapData = (entity.m_mirror) ? entity.m_mirror.clone():null;
	}
	
	
	ns_despair function update():void
	{
		if (entity.m_entityDirty)
		{
			this.bitmapData = entity.m_mirror.clone();
		}
	}
	
	
	ns_despair function recycle():void
	{
		entity = null;
		this.bitmapData.dispose();
		this.bitmapData = null;
		EntityPool.recycleMirror(this);
	}

}
}